package test.test1201;

import java.util.Random;
import java.util.Scanner;

public class test008 {
    public static void main(String[] args) {
        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字：");
        int num = r.nextInt(100) + 1;
        int a = sc.nextInt();
        int i = 1;
        while (true) {
            if (a == num) {
                System.out.println("恭喜你猜中了");
                break;
            } else if (a > num) {
                System.out.println("你猜的数据大了,请重新输入：");
                a = sc.nextInt();
            } else if (a < num) {
                System.out.println("你猜的数据小了,请重新输入：");
                a = sc.nextInt();
            }
            i++;
        }
    }
}
